#ifndef ATTRIBUTES_H
#define ATTRIBUTES_H


#include "dtwenty_global.h"


#include <collection.h>
#include <item.h>


#include <QMetaType>


typedef Item Attribute;


class DTWENTYSHARED_EXPORT Attributes : public Collection
{
    Q_OBJECT

public:

    enum Field
    {
        Field_FIRST = 0,

        Field_NAME = Field_FIRST,
        Field_ACRONYM,
        Field_DESC,

        Field_LAST = Field_DESC
    };

    Q_INVOKABLE Attributes(QObject *parent = 0) :
        Collection(QT_TR_NOOP("Attributes"), parent)
    {
    }

    Attributes(const Attributes& other) :
        Collection(other)
    {
    }

    Q_INVOKABLE virtual void onInitialize()
    {
        setField(Field_NAME, QT_TR_NOOP("Name"), false);
        setField(Field_ACRONYM, QT_TR_NOOP("Acronym"));
        setField(Field_DESC, QT_TR_NOOP("Description"));

        if (childItems().count()) return;

        Item* att = qobject_cast<Item*>(Attributes::create("Item", this));
        att->setValue(Field_NAME, "Strength");
        att->setValue(Field_ACRONYM, "Str");

        att = qobject_cast<Item*>(Attributes::create("Item", this));
        att->setValue(Field_NAME, "Dexterity");
        att->setValue(Field_ACRONYM, "Dex");

        att = qobject_cast<Item*>(Attributes::create("Item", this));
        att->setValue(Field_NAME, "Constitution");
        att->setValue(Field_ACRONYM, "Con");

        att = qobject_cast<Item*>(Attributes::create("Item", this));
        att->setValue(Field_NAME, "Intelligence");
        att->setValue(Field_ACRONYM, "Int");

        att = qobject_cast<Item*>(Attributes::create("Item", this));
        att->setValue(Field_NAME, "Wisdom");
        att->setValue(Field_ACRONYM, "Wis");

        att = qobject_cast<Item*>(Attributes::create("Item", this));
        att->setValue(Field_NAME, "Charisma");
        att->setValue(Field_ACRONYM, "Cha");
    }
};

Q_DECLARE_METATYPE(Attributes*)




#endif // ATTRIBUTES_H
